package com.jjh.springframework.test.common;

import com.jjh.springframework.bean.BeansException;
import com.jjh.springframework.bean.factory.config.BeanPostProcessor;
import com.jjh.springframework.test.bean.UserService;

/**
 * MyBeanPostProcessor
 *
 * @author jjh
 * @date 2021/06/20
 **/
public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
//        if ("userService".equals(beanName)) {
//            UserService userService = (UserService) bean;
//            userService.setLocation("改为：北京");
//        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }
}
